package com.xuecheng.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xuecheng.system.entity.Dictionary;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;


/**
 * <p>
 * 数据字典 Mapper 接口
 * </p>
 *
 * @author itcast
 */
public interface DictionaryMapper extends BaseMapper<Dictionary> {


    @Update("truncate table dictionary")
    void truncateTable();

    @Insert({"<script>",
            "insert into dictionary values",
            "<foreach collection = 'list' item = 'item' separator = ','>",
            "(null,#{item.name},#{item.code},#{item.itemValues})",
            "</foreach>",
            "</script>"
    })
    void insertAll(@Param("list") List<Dictionary> list);


}